$(document).ready(function(){
	var validator = $("#registerFrm").validate({
		success: function(label) {
			label.addClass('success');
		},
		rules: {
			username: {
				required: true
			},
			email: {
				required: true,
				email: true
			},
			password: {
				required: true,
				minlength: 6,
				maxlength: 20
			},
			password2: {
				required: true,
				maxlength: 20,
				equalTo: "#password"
			},
			phone: {
				required: true,
				minlength: 9,
				maxlength: 20
			},
			gender: {
				required: true
			},
			last_name: {
				required: true
			},
			first_name: {
				required: true
			},
			county: {
				required: true
			},
			city: {
				required: true
			},
			address: {
				required: true
			},
			university: {
				required: true
			},
			college: {
				required: true
			}
		},
		messages: {
			username: {
				checkData: "Utilizatorul introdus este deja inregistrata"
			},
			email: {
				email: "Adresa de e-mail nu este valida",
				checkData: "Adresa de e-mail este deja inregistrata"
			},
			password2: {
				equalTo: "Parola nu a fost confirmata"
			}
		},
		onkeyup: false
	});

	$('#county').change(function(){
		getCitiesOptions('county','city');
	})
	getCitiesOptions('county','city');

	var currentTime = new Date();
	$("#birth_date").datepicker({
		showOn: "button",
		buttonImage: "/media/images/front/wizard/calendar.gif",
		buttonImageOnly: true,
		dateFormat : 'yy-mm-dd',
		changeYear: true,
		minDate: new Date(1900, 1 - 1, 1),
		maxDate: currentTime,
		yearRange: '1900:'+currentTime.getFullYear(),
		firstDay: 1
	});
});